package designpattern.proxy;

import designpattern.proxy.Cglib.CglibProxy;
import designpattern.proxy.Cglib.HelloService;

public class Main {
    public static void main(String[] args) {
        /**
         * 静态代理
         */
//        StaticProxy proxyObject = new StaticProxy(new ReallyDoSubject());
//        proxyObject.request();
//        proxyObject.response();
//        proxyObject.around();

//        System.out.println("------------------------------动态代理(Interface)------------------------------------");
//        Subject subject = (Subject) Proxy.newProxyInstance
//                (Main.class.getClassLoader(),
//                        new Class[]{Subject.class},
//                        new JdkDynamicProxy(new ReallyDoSubject()));
//
//        subject.request();
//        subject.response();
//        subject.around();

        System.out.println("-----------------------------------Cglib代理(Class)-------------------------------");
        CglibProxy cglibProxy = new CglibProxy();
        HelloService helloService = (HelloService)cglibProxy.getProxy(HelloService.class);
        helloService.say();

        
    }
}
